﻿using CocoaAni.Net.WebSockets.Server.Enums;

namespace CocoaAni.Net.WebSockets.Server.Attributes;

public class MessageArgAttribute : Attribute
{
    public string? Name { get; set; }
    public ArgCategory Category { get; set; }
    public bool IsRequired { get; set; }
    public MessageArgAttribute(bool isRequired)
    {
        IsRequired=isRequired;
    }
    public MessageArgAttribute(string name, bool isRequired=false)
    {
        Name = name;
        IsRequired=isRequired;
    }
    public MessageArgAttribute(string name,ArgCategory category,bool isRequired=false)
    {
        Name=name;
        Category=category;
        IsRequired=isRequired;
    }
    public MessageArgAttribute(ArgCategory category, bool isRequired = false)
    {
        Category = category;
        IsRequired = isRequired;
    }
}

public class RequiredAttribute : MessageArgAttribute
{
    public RequiredAttribute() : base(true)
    {
    }
}

public class JsonPropArgAttribute : MessageArgAttribute
{
    public JsonPropArgAttribute(string name, bool isRequired = false) : base(name, isRequired)
    {
        Category = ArgCategory.JsonObject;
    }
    public JsonPropArgAttribute(bool isRequired) : base(isRequired)
    {
        Category = ArgCategory.JsonObject;
    }
    public JsonPropArgAttribute() : base(false)
    {
        Category = ArgCategory.JsonObject;
    }
}

public class JsonArgAttribute : MessageArgAttribute
{
    public JsonArgAttribute(bool isRequired=false) : base(isRequired)
    {
        Category = ArgCategory.JsonObject;
    }
}

public class TextArgAttribute : MessageArgAttribute
{
    public TextArgAttribute(bool isRequired=false) : base(isRequired)
    {
        Category = ArgCategory.MessageText;
    }
}

public class BinaryArgAttribute : MessageArgAttribute
{
    public BinaryArgAttribute(bool isRequired=false) : base(isRequired)
    {
        Category = ArgCategory.MessageBinary;
    }
}
